<%@ page import="java.io.File" %>
<%@ page import="com.bean.User" %>
<%@ page import="com.db.UserDao" %>
<%@ page import="com.bean.Passage" %>
<%@ page import="com.servlet.UserServlet" %>
<%@ page import="com.db.PassageDao" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery.min.js"></script>
    <!-- Custom Theme files -->
    <!--menu-->
    <link rel="shortcut icon" href="webicon.ico" type="image/x-icon" />
    <script src="js/scripts.js"></script>
    <link href="css/styles.css" rel="stylesheet">
    <!--//menu-->
    <!--theme-style-->
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
    <!--//theme-style-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</head>


<link rel="stylesheet" href="css/amazeui.css" />
<link rel="stylesheet" href="css/other.min.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人主页</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>


<body>


<!--header-->
<div class="navigation">
    <div class="container-fluid">
        <nav class="pull">
            <ul>
                <li><a  href="index.jsp">主页</a></li>
                <li><a  href="travelList.jsp?page=1">驴友游记</a></li>
                <li><a  href="share.jsp">发布游记</a></li>
            </ul>
        </nav>
    </div>
</div>

<div class="header">
    <div class="container">


        <div class="top-nav">
            <ul class="right-icons">

                <!--根据是否登录显示-->
                <li>
                    <% if(session.getAttribute("user") == null){ %>
                    <a  href="login.jsp">
                        <i class="glyphicon glyphicon-user">
                        </i>Login</a></li>
                <% } else {
                    //获取用户名name
                    int ID = ((User)(session.getAttribute("user"))).getUsername();
                    String name = ((User)(session.getAttribute("user"))).getName();%>
                <a  onclick="window.location.href='UserServlet?method=admin&ID=<%=ID%>'">
                    <i class="glyphicon glyphicon-user">
                    </i><%=name%></a></li>
                <% }
                %>

            </ul>


            <div class="nav-icon">
                <div class="hero fa-navicon fa-2x nav_slide_button" id="hero">
                    <a href="#"><i class="glyphicon glyphicon-menu-hamburger"></i> </a>
                </div>
            </div>

            <link href="css/popuo-box.css" rel="stylesheet" type="text/css" media="all"/>
            <script src="js/jquery.magnific-popup.js" type="text/javascript"></script>


            <script src="js/easyResponsiveTabs.js" type="text/javascript"></script>
            <script type="text/javascript">
                $(document).ready(function () {
                    $('#horizontalTab').easyResponsiveTabs({
                        type: 'default', //Types: default, vertical, accordion
                        width: 'auto', //auto or any width like 600px
                        fit: true   // 100% fit in a container
                    });
                });
            </script>
        </div>
    </div>
    <script>
        $(document).ready(function() {
            $('.popup-with-zoom-anim').magnificPopup({
                type: 'inline',
                fixedContentPos: false,
                fixedBgPos: true,
                overflowY: 'auto',
                closeBtnInside: true,
                preloader: false,
                midClick: true,
                removalDelay: 300,
                mainClass: 'my-mfp-zoom-in'
            });

        });
    </script>


</div>
<div class="container">
    <div class="buy-single-single">
            <div class="buy-sin-single">
                <div class="col-sm-5 middle-side immediate">
                    <!--获取用户个人信息customer表-->
                    <%
                        int ID = ((User)(session.getAttribute("userAdmin"))).getUsername();
                        String name = ((User)(session.getAttribute("userAdmin"))).getName();
                        int age = ((User)(session.getAttribute("userAdmin"))).getAge();
                        String sex = ((User)(session.getAttribute("userAdmin"))).getSex();
                        String email = ((User)(session.getAttribute("userAdmin"))).getEmail();
                        String introduction = ((User)(session.getAttribute("userAdmin"))).getIntroduction();
                    %>
                    <h4>用户资料：</h4>
                    <p><span class="bath1">Email</span><span class="two">&nbsp;&nbsp;&nbsp;<%=email%></span></p> 
                    <p><span class="bath1">用户名 </span><span class="two"><%=name%></span></p>
                    <p><span class="bath1">年龄</span><span class="two">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=age%></span></p>
                    <p><span class="bath1">性别</span><span class="two">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=sex%></span></p>
                     
                    
                </div>
                <div class="col-sm-7 buy-sin">
                    <h4>主页简介</h4>
                    <p><%=introduction%>
                </div>
                <br><br><br><br><br><br><br>
                <div class="   right-side">
                        <a href="adminEdit.jsp" class="hvr-sweep-to-right more" >编辑主页</a>
                </div>
            </div>
    </div>
    
</div>
<!--travelList-->
<div class="travelList" >
    <div class="container">
              
                    <div style = "width:100%;"class="col-md-9 single-box">
                    <!-- ----重复每页的游记---- -->
                        <div class="nobreak">
	                        <!--连接Route数据库，动态生成网页-->
	                        <%
	                        	UserDao connectPassageForNum = new UserDao();
							    int resultNumber = connectPassageForNum.searchPassageNumberFromAdmin(ID);
							%>
                            <!--根据数据库中的结果动态生成列表-->
                            <%
                                int time = 1;
                                String getID=new String(),getTitle=new String();
                                int getPassageID;
                                UserDao connectPassage = new UserDao();
                                Passage newPassage = new Passage();

                                while(time <= resultNumber)
                                {
                                    connectPassage.searchAdminPassage(newPassage,ID,time);
                            %>
                            <!-- ---------------------------- -->
                            <div style="float:left;margin:1;padding:0;width:48%; height:400px; ">
                                <div class=" col-sm-7 left-side "  style="color:#294819;">
                                    <a href="travelDetails.jsp?passageID=<%=newPassage.getPassageID()%>&page=1"> <img height="250" width="300" src="psgPhoto/image/image/<%=newPassage.getPassageID()%>_1.jpeg" alt=""></a>
                                </div>
                                <div class="  col-sm-5 middle-side">
                                    <h4><%=newPassage.getTitle()%></h4>
                                    <p>城市：<%=newPassage.getCity()%></p>
                                    <p>天数：<%=newPassage.getDays()%></p>
                                    <p>
                                    <form method="post" action="UserServlet?method=delete" class="am-form" data-am-validator>
                                        <input type="hidden" name="passageID" value="<%=newPassage.getPassageID()%>">
                                        <input type="hidden" name="email"  value="<%=email%>">
                                        <input type="hidden" name="ID"  value="<%=ID%>">
                                     <button class="hvr-sweep-to-right more am-btn am-btn-secondary" type="submit" name="action">删除文章</button>
                                     </form>
                                       <!-- a href="travelDetails.jsp?passageID=<%=newPassage.getPassageID()%>&page=1" class="hvr-sweep-to-right more" type="submit" name="action">删除&gt;&gt;</a---->
                                    </p>
                                </div>
                            </div>
                            <!-- -------------------------------- -->
                            <%
                                    time++;
                                }
                            %>
					    </div>
					<!-- ----重复每页的游记---- -->

	             </div>
    </div>
</div>			
<!--//travelList-->


</body>
</html>
